/*
 * chumby::HTTPContentHandler
 * Copyright (C) Chumby Industries, 2007
 *
 * based on Artemis Copyright (C) 2007 Andreas Buechele
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef _CHUMBY_HTTP_CONTENT_HANDLER_H
#define _CHUMBY_HTTP_CONTENT_HANDLER_H

#include <chumby_httpd/chumby_http_request.h>
#include <chumby_httpd/chumby_http_response.h>

namespace chumby {
	class HTTPContentHandler {
	public:
		virtual ~HTTPContentHandler() {}
		virtual chumby::HTTPResponse * handleRequest(const chumby::HTTPRequest & request) = 0;
	};

	class HTTPEchoContentHandler:public chumby::HTTPContentHandler {
	public:
		chumby::HTTPResponse * handleRequest(const chumby::HTTPRequest & request);
	};

	class HTTPDefaultContentHandler:public chumby::HTTPContentHandler {
	public:
		HTTPDefaultContentHandler(std::string &resp,std::string &mimeType);
		HTTPDefaultContentHandler(const char *resp, const char *mimeType);
		chumby::HTTPResponse * handleRequest(const chumby::HTTPRequest & request);
	protected:
		std::string _response;
		std::string _mimeType;
	};

	class HTTPSimpleContentHandler:public chumby::HTTPDefaultContentHandler {
	public:
		HTTPSimpleContentHandler(std::string &path,std::string &resp,std::string &mimeType);
		HTTPSimpleContentHandler(const char *path,const char *resp,const char *mimeType);
		chumby::HTTPResponse * handleRequest(const chumby::HTTPRequest & request);
	private:
		std::string _path;
	};

	class HTTPSimpleFileContentHandler:public chumby::HTTPContentHandler {
	public:
		HTTPSimpleFileContentHandler(std::string &path,std::string &filePath,std::string &mimeType);
		HTTPSimpleFileContentHandler(const char *path,const char *filePath,const char *mimeType);
		chumby::HTTPResponse * handleRequest(const chumby::HTTPRequest & request);
	private:
		std::string _path;
		std::string _filePath;
		std::string _mimeType;
	};
}

#endif
